package cn.yitun.chat.yitunserverimcore.general.main.biz.personal.manager;

import cn.yitun.chat.yitunservercommonlib.dataentity.vo.system.user.UserVo;
import cn.yitun.chat.yitunservercommonlib.util.codec.IdGen;
import cn.yitun.chat.yitunserverimbase.dao.system.UserDao;
import cn.yitun.chat.yitunserverimcore.general.main.push.user.PersonalPush;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 
 * Description <br>
 * Date 2019-05-05 09:42:44<br>
 * 
 * @author yitun
 * @since 1.1
 */
@Service
public class PersonalManager {

	@Resource
	private UserDao userDAO;
	@Resource
	private PersonalPush personalPush;

	public boolean isExistMobile(String mobile) {
		UserVo u = userDAO.getUserVOByMobile(mobile);
		return null != u;
	}

	public boolean updatePassword(Long userId, String password) {
		int mark = userDAO.updatePassword(userId, password);
		if (mark > 0) {
			personalPush.pushUpdatePassword(IdGen.getNumber(), userId);
		}
		return mark > 0;
	}
}
